package com.per.mybootall.es.conteoller;

import com.per.mybootall.common.ResponseCode;
import com.per.mybootall.es.server.ElasticSearchServer;
import com.per.yyyFrame.common.ServerResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: yyy
 * Date: 2022/5/26
 * Time: 16:09
 * Description:
 */
@RestController
@RequestMapping("/selectElasticSearchSelect")
public class ElasticSearchSelect {

  @Resource
  private ElasticSearchServer elasticSearchServer;

  //
  @GetMapping("/getListPage")
  public ServerResponse getListPage(@RequestParam Map params) throws IOException {
    return new ServerResponse(ResponseCode.SUCCESS.getCode(),elasticSearchServer.getListPage(params));
  }

  //根据id获取详情
  @GetMapping("/getDetailById")
  public ServerResponse getDetailById(@RequestParam Map params){
    return new ServerResponse(ResponseCode.SUCCESS.getCode(),elasticSearchServer.getDetailById(params));
  }

  //数据导出
  @GetMapping("/exportList")
  public ServerResponse exportList(@RequestParam Map params){
    return new ServerResponse(ResponseCode.SUCCESS.getCode(),elasticSearchServer.exportList(params));
  }

}
